#include "CriticalSection.h"

namespace GPUCC
{
	namespace CPU
	{
		CriticalSection::CriticalSection()
		{
			InitializeCriticalSection(&this->m_CriticalSection);
		}

		CriticalSection::~CriticalSection()
		{
			DeleteCriticalSection(&this->m_CriticalSection);
		}

		void CriticalSection::Enter()
		{
			EnterCriticalSection(&this->m_CriticalSection);
		}

		void CriticalSection::Leave()
		{
			LeaveCriticalSection(&this->m_CriticalSection);
		}

		bool CriticalSection::TryEnter()
		{
			return (TryEnterCriticalSection(&this->m_CriticalSection));
		}
	}
}